<script setup lang="ts">
import PlantHeadlineItem from "@/components/plant/PlantHeadlineItem.vue"
import type { HeadlineItem } from "@/type/lidare"
import { getHeadlineList_l } from "@/api/lidare"
import { ref } from "vue"
const headlineList = ref<Array<HeadlineItem>>([]);
const healinePage = ref(-1);
const loading = ref(false);
const finished = ref(false);
const onLoad = async () => {
  healinePage.value++;
  let res = await getHeadlineList_l(healinePage.value);
  headlineList.value = [...headlineList.value, ...res.data._data.lists];
  loading.value = false;
}
</script>
<template>
  <div class="headline">
    <van-list v-model:loading="loading" :finished="finished" finished-text="没有更多了" @load="onLoad">
      <div class="video-list">
        <PlantHeadlineItem v-for="(item,index) in headlineList" :key="index" :item="item"/>
      </div>
    </van-list>
  </div>
</template>
<style lang="scss" scoped>
.headline{
  width: 100%;
  box-sizing: border-box;
  padding: .2rem .1rem;
  background-color: var(--bgc-gray);
}
</style>